package com.ccit.springbootlaw.pojo;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Objects;

@Entity
@Table(name = "roots") // 显式指定表名
// 管理员表
// id (主键)
// name (管理员名称)
// email (管理员邮箱)
// password (管理员密码)
// role (管理员角色)
// created_at (创建时间)
// updated_at (更新时间)
public class Root {
    private int id;
    private String name;
    private String email;
    private String password;
    private String role;
    private Timestamp created_at;
    private Timestamp updated_at;

    @Id
    @Column(name = "id")
    // id (主键)
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Basic
    @Column(name = "name")
    // name (管理员名称)
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Basic
    @Column(name = "email")
    // email (管理员邮箱)
    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    @Basic
    @Column(name = "password")
    // password (管理员密码)
    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Basic
    @Column(name = "role")
    // role (管理员角色)
    public String getRole() {
        return role;
    }

    public void setRole(String role) {
        this.role = role;
    }

    @Basic
    @Column(name = "created_at")
    // created_at (创建时间)
    public Timestamp getCreatedAt() {
        return created_at;
    }

    public void setCreatedAt(Timestamp createdAt) {
        this.created_at = createdAt;
    }

    @Basic
    @Column(name = "updated_at")
    // updated_at (更新时间)
    public Timestamp getUpdatedAt() {
        return updated_at;
    }

    public void setUpdatedAt(Timestamp updatedAt) {
        this.updated_at = updatedAt;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Root roots = (Root) o;
        return id == roots.id && Objects.equals(name, roots.name) && Objects.equals(email, roots.email) && Objects.equals(password, roots.password) && Objects.equals(role, roots.role) && Objects.equals(created_at, roots.created_at) && Objects.equals(updated_at, roots.updated_at);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, name, email, password, role, created_at, updated_at);
    }
}